<?php

/**
 * This is the model class for table "user_role_perm".
 *
 * The followings are the available columns in table 'user_role_perm':
 * @property integer $id_user_role_perm
 * @property integer $account_manage
 * @property integer $account_search
 * @property integer $group_manage
 * @property integer $host_manage
 * @property integer $user_manage
 * @property integer $backup_manage
 * @property integer $config_manage
 */
class UserRolePerm extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return UserRolePerm the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'user_role_perm';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('account_manage, account_search, group_manage, host_manage, user_manage, backup_manage, config_manage', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id_user_role_perm, account_manage, account_search, group_manage, host_manage, user_manage, backup_manage, config_manage', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_user_role_perm' => 'Id User Role Perm',
			'account_manage' => 'Account Manage',
			'account_search' => 'Account Search',
			'group_manage' => 'Group Manage',
			'host_manage' => 'Host Manage',
			'user_manage' => 'User Manage',
			'backup_manage' => 'Backup Manage',
			'config_manage' => 'Config Manage',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_user_role_perm',$this->id_user_role_perm);
		$criteria->compare('account_manage',$this->account_manage);
		$criteria->compare('account_search',$this->account_search);
		$criteria->compare('group_manage',$this->group_manage);
		$criteria->compare('host_manage',$this->host_manage);
		$criteria->compare('user_manage',$this->user_manage);
		$criteria->compare('backup_manage',$this->backup_manage);
		$criteria->compare('config_manage',$this->config_manage);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}